<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Execute a previously prepared query</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ibase-errmsg.html">ibase_errmsg</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ibase-fetch-assoc.html">ibase_fetch_assoc</a></div>
 <div class="up"><a href="ref.ibase.html">Firebird/InterBase 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ibase-execute" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ibase_execute</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">ibase_execute</span> &mdash; <span class="dc-title">Execute a previously prepared query</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ibase-execute-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>ibase_execute</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$query</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$bind_arg</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...</code></span>
  ]] )</div>

  <p class="para rdfs-comment">
   Execute a query prepared by <span class="function"><a href="function.ibase-prepare.html" class="function">ibase_prepare()</a></span>. 
  </p>
  <p class="para">
   This is a lot more effective than using <span class="function"><a href="function.ibase-query.html" class="function">ibase_query()</a></span>
   if you are repeating a same kind of query several times with only
   some parameters changing.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ibase-execute-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">query</code></em></dt>

     <dd>

      <p class="para">
       An InterBase query prepared by <span class="function"><a href="function.ibase-prepare.html" class="function">ibase_prepare()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">bind_arg</code></em></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">...</code></em></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ibase-execute-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   If the query raises an error, returns <strong><code>FALSE</code></strong>. If it is successful and
   there is a (possibly empty) result set (such as with a SELECT query),
   returns a result identifier. If the query was successful and there were
   no results, returns <strong><code>TRUE</code></strong>.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This function returns the number of rows affected by
    the query (if &gt; 0 and applicable to the statement type). A query that
    succeeded, but did not affect any rows (e.g. an UPDATE of a non-existent
    record) will return <strong><code>TRUE</code></strong>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ibase-execute-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1081">
    <p><strong>Example #1 <span class="function"><strong>ibase_execute()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$dbh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ibase_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$host</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$username</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$password</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$updates&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'Eric'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">5&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'Filip'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">7&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'Larry'<br /></span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$query&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ibase_prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"UPDATE&nbsp;FOO&nbsp;SET&nbsp;BAR&nbsp;=&nbsp;?&nbsp;WHERE&nbsp;BAZ&nbsp;=&nbsp;?"</span><span style="color: #007700">);<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">$updates&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$baz&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$bar</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ibase_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$query</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$bar</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$baz</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ibase-execute-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.ibase-query.html" class="function" rel="rdfs-seeAlso">ibase_query()</a> - Execute a query on an InterBase database</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ibase-errmsg.html">ibase_errmsg</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ibase-fetch-assoc.html">ibase_fetch_assoc</a></div>
 <div class="up"><a href="ref.ibase.html">Firebird/InterBase 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
